from ftplib import FTP



#ftp = FTP(host='10.1.173.161')
#ftp.login(user='root', passwd='auto')
##ftp.mkd('eee')
#ftp.storbinary('STOR test.txt', open('D:\\test.txt','rb'))
#ftp.quit()

class FTPD:
    def __init__(self,host='10.1.173.161',user='root',passwd='auto'):
        self.ftp = FTP(host)
        self.ftp.login(user=user, passwd=passwd)
    def mkd(self,dirname):
        self.ftp.mkd(dirname)
    def cwd(self,dirname):
        self.ftp.cwd(dirname)
        
    def upLoadFiles(self,filelist):    
        import os
        for file in filelist:
            if os.path.exists(file):
                bn = os.path.basename(file)
                self.ftp.storbinary('STOR '+bn, open(file,'rb'))
    
    def __del__(self):
        self.ftp.quit() 



